#define _CRT_SECURE_NO_WARNINGS 1

double average(int* salary, int salarySize) {
    int max = 0;
    int min = 1000000;
    double sum = 0;
    int i = 0;
    for (i = 0; i < salarySize; i++)
    {
        if (salary[i] > max)
            max = salary[i];
        if (salary[i] < min)
            min = salary[i];
        sum += salary[i];
    }
    sum = sum - min - max;
    return sum / (salarySize - 2);
}